//
// Created by bbnf on 09.06.2024.
//

#ifndef TODOAPPCPP_STORAGE_TODO_H
#define TODOAPPCPP_STORAGE_TODO_H

#include "storage_pch.h"

namespace TodoApp::Storage {
    class Todo {
    public:
        enum Priority : std::int8_t {
            Low, Medium, High
        };
    private:
        std::string m_title;
        std::string m_description;
        bool m_done;
        Priority m_priority;
        std::int64_t m_done_time;

    public:
        explicit Todo(std::string title, std::string description);

        ~Todo() = default;

        friend auto operator<<(std::ostream &os, const Todo& todo) -> std::ostream&;

        [[nodiscard]] auto done() const -> bool { return m_done; }

        [[nodiscard]] auto title() const -> std::string { return m_title; }

        [[nodiscard]] auto description() const -> std::string { return m_description; }

        [[nodiscard]] auto priority() const -> Priority { return m_priority; }

        [[nodiscard]] auto endDate(std::string format = "%d.%m.%Y %H:%M") -> std::string;

        void setDone(const bool &done);

        void setDoneTime(const std::int64_t &time);

        void setPriority(const std::int8_t &priority);

        auto serialize() const -> std::string;

        /**
         * Измеинить статус
         */
        void switchDone();

        /**
         * Изменить приоритет
         */
        void setPriority(Priority priority);

        void setTitle(std::string title);

        void setDescription(std::string description);
    };
}  // namespace TodoApp::Storage
#endif //TODOAPPCPP_STORAGE_TODO_H
